package com.ldu.exam.model;

import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.UpdateTimestamp;

import com.fasterxml.jackson.annotation.JsonView;
import com.ldu.view.View.Mini;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@Entity
@Table(name="t_menu")
public class MenuModel 
{
	@Id
	@Column(length=32)
	@GeneratedValue(strategy = GenerationType.IDENTITY,generator = "jpa-uuid")
	@GenericGenerator(name = "jpa-uuid", strategy = "uuid.hex")
	@JsonView(Mini.class)
	private String id ;
	
	/**
	 * 名称
	 */
	@JsonView(Mini.class)
	private String name ;
	
	/**
	 * 备注
	 */
	private String summary ;
	
	
	/**
	 * 启用禁用
	 */
	private String state;
	
	/**
	 * 上级菜单
	 */
	@JsonView(Mini.class)
	private String parentId;
	
	/**
	 * 优先级
	 */
	@JsonView(Mini.class)
	private Integer priority;
	
	/**
	 * 路由
	 */
	@JsonView(Mini.class)
	private String route;
	
	/**
	 * 父菜单名称
	 */
	@Transient
	private String parentName; 
	
	/**
	 * 创建人
	 */
	@OneToOne
	@JoinColumn(name="createdid")
	private AccountModel created;
	
	/**
	 * 创建时间
	 */
	@CreationTimestamp
	private Timestamp creationDate ;
	
	/**
	 * 修改时间
	 */
	@UpdateTimestamp
	private Timestamp updateDate ;
}
